<template>
  <div id="app">
    <div id="nav">
      <router-link to="/">首页</router-link> |
      <router-link to="/public-activities">活动列表</router-link>
      <template v-if="$store.state.userRole === 'admin'">
        | <router-link to="/activity-management">活动管理</router-link>
      </template>
      | <router-link to="/login" v-if="!$store.state.userRole">登录</router-link>
      <span v-else> | 欢迎，{{ $store.state.userRole === 'admin' ? '管理员' : '同学' }}</span>
    </div>
    <router-view/>
  </div>
</template>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}
</style>
